<html>
	<head>	
		<title>Tecnicos YA!</title>
		
		<!-- API KEY googlemaps -->
		<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyBsDZ3rcOS1HJvXCHh5PpdtjyUxj3DVib4&sensor=true"></script>
        
		<!-- jQuery -->
		<script type="text/javascript" src="/tecnicosya/web/js/jquery-1.10.2.min.js"></script>
		<script type="text/javascript" src="/tecnicosya/web/js/jquery-ui-1.10.3.custom.min.js"></script>
		<link type="text/css" rel="stylesheet" href="/tecnicosya/web/css/jquery/cupertino/jquery-ui-1.10.3.custom.min.css">
		
		<!-- validators -->
		<script src="/tecnicosya/web/js/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
		<script src="/tecnicosya/web/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
		<link type="text/css" rel="stylesheet" href="/tecnicosya/web/css/validationEngine.jquery.css"/>

		<!-- Aplicacion -->
		<script type="text/javascript" src="/tecnicosya/web/js/script.js"></script> 
		<!-- <script type="text/javascript" src="/tecnicosya/web/js/pruebamapa.js"></script> <!-- contiene prueba maps js -->	
		<link type="text/css" rel="stylesheet" href="/tecnicosya/web/css/style.css">

		
		<script>
			$(function(){
				// Inicializo las form-tables de la aplicacion
				$(".form-table").find("td").attr('class', 'input-wrapper');
				$(".form-table").find("label").parent().attr('class', 'label-wrapper');	
				$('#form').validationEngine();		
				$('#form_pass_editor').validationEngine();			
			});

			function cerrar_sesion()
			{	
				if(confirm("¿Seguro desea cerrar la sesión actual?"))
				{
					$.post("<?php echo site_url(array("auth", "cerrar_sesion"));?>")
					
					.done(function(){
						window.location = "<?php echo site_url(array('inicio'));?>";			
					})
	
					.fail(function(error) {
						alert(error.responseText);
					});
				}
			}
			
		</script>
		
	</head>	
	<body>
		<div id="header">
			<div id="header-image">
				<img src="<?php echo site_url(array('web', 'img', 'header.png'));?>"/>
			</div>	
			<div id="login-container">
				<?php if(!get_user_auth()):?>
					<a href="javascript:login_popup_open();">Autenticarme</a> |
					<a href="<?php echo site_url(array('inicio', 'registrar'));?>">Registro</a>
				<?php else:?>
					<a href="javascript:cerrar_sesion();">Cerrar sesión</a>
				<?php endif;?> 				
			</div>			
		</div>
		
		<div id="menu">
			<div style="float:left;">
				 <ul>
				      <li><a href=<?php echo site_url(array('inicio'));?>>INICIO</a></li>
				      
				      <?php if (get_user_auth()):?>
							<li><a href=<?php echo site_url(array('perfil'));?>>PERFIL</a></li>
				      <?php endif;?>
				      
				      <li><a href=<?php echo site_url(array('tecnico'));?>>TECNICOS</a></li>
				      <li><a href=<?php echo site_url(array('servicio'));?>>TIPOS DE SERVICIO</a></li>
				      <li><a href=<?php echo site_url(array('cliente'));?>>CLIENTES</a></li>
				      <li><a href=<?php echo site_url(array('sms'));?>>SMS</a></li>
				      <li><a href=<?php echo site_url(array('paypal'));?>>PAYPAL</a></li>
				 </ul>
			</div>			 
			<?php if(get_user_auth()):?>
				<div id="user-auth-container">
				 	<?php $user_auth = get_user_auth();  
				 		  echo 'Bienvenido/a '. $user_auth['nombres'] .' '. $user_auth['apellidos']; ?>
				</div>
			<?php endif;?>
		 </div>
		 				
		<div id="content"> 
			<?php include site_path(array('app', 'views', $view), '.php');?>			 			 	
		</div>
				
		<div id="footer">
			<p>Tecnicos YA! - Laboratorio PHP (Tecnólogo Informatico)</p>
		</div>
		
		<!-- Validaciones especiales.  -->
		<script type="text/javascript" src="/tecnicosya/web/js/validaciones.js"></script>
		
		<!-- Login popup -->
		<?php include site_path(array('app', 'views', 'login_popup'), '.php');?>
		
		<!-- Mapa -->
		<?php include site_path(array('app', 'views', 'mapa'), '.php');?>
		
	</body>
</html>
